package com.ruoyi.ini.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.ini.domain.XlkjIniSurvey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ini.mapper.XlkjIniMapper;
import com.ruoyi.ini.domain.XlkjIni;
import com.ruoyi.ini.service.IXlkjIniService;

/**
 * 事件Service业务层处理
 *
 * @author wang
 * @date 2022-02-08
 */
@Service
public class XlkjIniServiceImpl implements IXlkjIniService
{
    @Autowired
    private XlkjIniMapper xlkjIniMapper;

    /**
     * 查询事件
     *
     * @param id 事件主键
     * @return 事件
     */
    @Override
    public XlkjIni selectXlkjIniById(Long id)
    {
        return xlkjIniMapper.selectXlkjIniById(id);
    }

    /**
     * 查询事件列表
     *
     * @param xlkjIni 事件
     * @return 事件
     */
    @Override
    public List<XlkjIni> selectXlkjIniList(XlkjIni xlkjIni)
    {
        return xlkjIniMapper.selectXlkjIniList(xlkjIni);
    }

    /**
     * 新增事件
     *
     * @param xlkjIni 事件
     * @return 结果
     */
    @Override
    public int insertXlkjIni(XlkjIni xlkjIni)
    {
        xlkjIni.setCreateTime(DateUtils.getNowDate());
        return xlkjIniMapper.insertXlkjIni(xlkjIni);
    }

    /**
     * 修改事件
     *
     * @param xlkjIni 事件
     * @return 结果
     */
    @Override
    public int updateXlkjIni(XlkjIni xlkjIni)
    {
        xlkjIni.setUpdateTime(DateUtils.getNowDate());
        return xlkjIniMapper.updateXlkjIni(xlkjIni);
    }

    /**
     * 批量删除事件
     *
     * @param ids 需要删除的事件主键
     * @return 结果
     */
    @Override
    public int deleteXlkjIniByIds(Long[] ids)
    {
        return xlkjIniMapper.deleteXlkjIniByIds(ids);
    }

    /**
     * 删除事件信息
     *
     * @param id 事件主键
     * @return 结果
     */
    @Override
    public int deleteXlkjIniById(Long id)
    {
        return xlkjIniMapper.deleteXlkjIniById(id);
    }

    /**
     * 查询该条事件是否超时
     *
     * @param id
     */
    @Override
    public Long selectTimeStatus(Long id) {
        return xlkjIniMapper.selectTimeStatus(id);
    }

    /**
     * @param departmentId
     */
    @Override
    public List<XlkjIni> selectInciByDepartmentId(String[] departmentId) {
        return xlkjIniMapper.selectInciByDepartmentId(departmentId);
    }

    @Override
    public XlkjIniSurvey selectIncidentsNumByDeptId(Long deptId) {
        return xlkjIniMapper.selectIncidentsNumByDeptId(deptId);
    }
}
